Skip to content

fix(map-ruler): disable layer clicks during measurement#1236

Merged
vkozio merged 3 commits intomainfrom
codex/make-map-layers-not-clickable-during-distance-tool
Aug 8, 2025
Merged

fix(map-ruler): disable layer clicks during measurement#1236
vkozio merged 3 commits intomainfrom
codex/make-map-layers-not-clickable-during-distance-tool

Conversation

@alesiahil
Copy link
Contributor

@alesiahil alesiahil commented Aug 3, 2025

https://kontur.fibery.io/Product_management/Pain_Point/Ruler-While-measuring-when-I-click-on-the-map-an-active-contributor-page-opens-in-a-new-tab-and-dist-217

Summary

  • prevent feature clicks while measuring distance by using highest priority listeners
  • document Map Ruler priority in event management docs
  • cover Map Ruler listener priority with a unit test

Testing

  • pnpm lint
  • pnpm vitest run

https://chatgpt.com/codex/tasks/task_e_688fd1f2da14832fa13735788a8982c7

Summary by CodeRabbit

  • Bug Fixes

    • Increased the priority of Map Ruler event listeners to ensure they take precedence over other map interactions.
  • Documentation

    • Updated all documentation to reflect the new Map Ruler listener priority value (changed from 1 to 100) in diagrams, tables, and descriptions.
  • Tests

    • Added tests to verify that Map Ruler event listeners are registered with the correct (higher) priority.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 3, 2025

Warning

Rate limit exceeded

@alesiahil has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea49b5 and 394c8cd.

📒 Files selected for processing (1)
  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts (1 hunks)

Walkthrough

The priority assigned to the Map Ruler event listener system was increased from 1 to 100 across documentation and implementation. This affects event listener registration in code and updates all corresponding documentation, diagrams, and tests to reflect the new priority value. No other logic or control flow changes were made.

Changes

Cohort / File(s) Change Summary
Documentation: Map Ruler Priority Update
docs/architecture/ADR-002-MapPopover-Event-System-Integration.md, docs/investigations/R006-map-event-management.md, docs/investigations/map-event-management-system.md
Updated all references, diagrams, tables, and descriptions of Map Ruler event listener priority from 1 to 100.
Implementation: MapRulerRenderer Priority
src/features/map_ruler/renderers/MapRulerRenderer.ts
Changed the priority argument in registerMapListener calls from 1 to 100 for 'click' and 'mousemove' events.
Testing: MapRulerRenderer Listener Priority
src/features/map_ruler/renderers/MapRulerRenderer.test.ts
Added a new test suite verifying that listeners are registered with priority 100 and block other map interactions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/make-map-layers-not-clickable-during-distance-tool

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Aug 3, 2025

Language To Recheck Fuzzy Untranslated Total
ar 3 216 837 1056
be 0 41 0 41
de 2 216 837 1055
es 3 216 837 1056
id 2 216 837 1055
ko 3 216 837 1056
ru 0 24 0 24
uk 0 18 799 817
zh 0 43 0 43

@github-actions
Copy link

github-actions bot commented Aug 3, 2025

Bundle size diff

Old size New size Diff
5.07 MB 5.07 MB -1 B (-0.00%)

@github-actions
Copy link

github-actions bot commented Aug 3, 2025

Preview environments for this PR:

These previews are automatically updated with each commit.

Note: After a new deployment, it may take a few minutes for the changes to propagate and for caches to update. During this time, you might experience temporary loading issues or see an older version of the app. If the app fails to load, please wait a few minutes and try again.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e42573e and 9ea49b5.

📒 Files selected for processing (5)
  • docs/architecture/ADR-002-MapPopover-Event-System-Integration.md (4 hunks)
  • docs/investigations/R006-map-event-management.md (5 hunks)
  • docs/investigations/map-event-management-system.md (5 hunks)
  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts (1 hunks)
  • src/features/map_ruler/renderers/MapRulerRenderer.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{js,jsx,ts,tsx,py,java,go,rb}

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.{js,jsx,ts,tsx,py,java,go,rb}: If a file with code grows longer than 500 lines, refactor it into two or move some parts into already created libraries.
Do not mix tabs and spaces in code.
Write extensive code comments in the code itself.
Write insightful code comments.
Add empty lines between logical blocks as in the rest of the codebase.
Format the code nicely and consistently.
Add enough debug logs so you can find out what's wrong but not be overwhelmed when something does not work as expected.
Write enough comments so you can deduce what was a requirement in the future and not walk in circles.

Files:

  • src/features/map_ruler/renderers/MapRulerRenderer.ts
  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
src/**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (AGENTS.md)

If Reatom v2 is used in the Front End, upgrade it to v3.

Files:

  • src/features/map_ruler/renderers/MapRulerRenderer.ts
  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
**/*.md

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.md: When moving around md files also fix the links in them and links to them across all others.
Start sentences at new lines in docs for cleaner git diffs.

Files:

  • docs/architecture/ADR-002-MapPopover-Event-System-Integration.md
  • docs/investigations/R006-map-event-management.md
  • docs/investigations/map-event-management-system.md
docs/**/*

📄 CodeRabbit Inference Engine (AGENTS.md)

docs/**/*: docs/ folder has general project documentation that needs to be kept up to date.
Fix everything in the docs/ folder to match reality.

Files:

  • docs/architecture/ADR-002-MapPopover-Event-System-Integration.md
  • docs/investigations/R006-map-event-management.md
  • docs/investigations/map-event-management-system.md
**/*.{test,spec}.{js,jsx,ts,tsx,py,java}

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.{test,spec}.{js,jsx,ts,tsx,py,java}: Always add a custom assertion message when writing assertions in unit tests, including as much context as possible. Incorporate input data and relevant test details so it's immediately clear what is being verified and why it might fail.
For any fix you are implementing try to add test so that it won't repeat in the future.

Files:

  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
src/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (AGENTS.md)

Every spot that uses external library in the Front End has to be covered at least once in tests so it's easy to merge dependabot version bump PRs.

Files:

  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
🧠 Learnings (2)
📚 Learning: the `closeatlasbanner` method in the `helperbase` class is covered by existing tests in `e2e/popuppo...
Learnt from: amurKontur
PR: konturio/disaster-ninja-fe#727
File: e2e/page-objects/helperBase.ts:0-0
Timestamp: 2024-06-10T19:32:46.895Z
Learning: The `closeAtlasBanner` method in the `HelperBase` class is covered by existing tests in `e2e/popupPopulation.spec.ts`, `e2e/login.spec.ts`, `e2e/location.spec.ts`, and `e2e/auth.setup.ts`.

Applied to files:

  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
📚 Learning: the `webkit` project configuration in `playwright.config.ts` is covered by tests that do not match t...
Learnt from: amurKontur
PR: konturio/disaster-ninja-fe#727
File: playwright.config.ts:59-66
Timestamp: 2024-06-10T19:32:46.895Z
Learning: The `webkit` project configuration in `playwright.config.ts` is covered by tests that do not match the `testIgnore` patterns `/WithUser/` and `location.spec.ts`.

Applied to files:

  • src/features/map_ruler/renderers/MapRulerRenderer.test.ts
🧬 Code Graph Analysis (2)
src/features/map_ruler/renderers/MapRulerRenderer.ts (1)
src/core/shared_state/mapListeners.ts (1)
  • registerMapListener (142-152)
src/features/map_ruler/renderers/MapRulerRenderer.test.ts (2)
src/features/map_ruler/renderers/MapRulerRenderer.ts (1)
  • MapRulerRenderer (31-118)
src/core/shared_state/mapListeners.ts (1)
  • registerMapListener (142-152)
🪛 LanguageTool
docs/architecture/ADR-002-MapPopover-Event-System-Integration.md

[grammar] ~71-~71: Use correct spacing
Context: ...ty 10) can block all other interactions via return false - MapPopover still triggers despite tool exclusivity...

(QB_NEW_EN_OTHER_ERROR_IDS_5)

docs/investigations/R006-map-event-management.md

[grammar] ~290-~290: There might be a problem here.
Context: ...ractions. 1. Map Ruler (Priority: 100) - Location: MapRulerRenderer.ts:109 - click handler: Calls event.preventDefault() and retu...

(QB_NEW_EN_MERGED_MATCH)

docs/investigations/map-event-management-system.md

[grammar] ~232-~232: There might be a problem here.
Context: ...ractions. 1. Map Ruler (Priority: 100) - Location: MapRulerRenderer.ts:109 - click handler: Calls event.preventDefault() and retu...

(QB_NEW_EN_MERGED_MATCH)

🪛 GitHub Actions: build
src/features/map_ruler/renderers/MapRulerRenderer.test.ts

[error] 17-17: TypeScript error TS2339: Property 'mock' does not exist on the specified function type.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: deploy
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
src/features/map_ruler/renderers/MapRulerRenderer.ts (1)

110-116: Excellent priority adjustment for blocking behavior.

The priority increase from 1 to 100 correctly implements the highest priority event handling to ensure Map Ruler blocks all other map interactions during measurement. The explanatory comment clearly documents the intent.

docs/investigations/R006-map-event-management.md (4)

46-46: Documentation correctly updated to reflect priority change.

The architecture diagram accurately shows Map Ruler's elevated priority of 100, maintaining consistency with the implementation changes.


142-142: Code comment example properly updated.

The example code comment correctly reflects the new priority value of 100, maintaining documentation accuracy.


271-271: Inventory table accurately reflects priority change.

The registered listeners table correctly shows Map Ruler's priority as 100, maintaining consistency across all documentation sections.


290-290: Detailed analysis section properly updated.

The listener purpose analysis correctly identifies Map Ruler's priority as 100, ensuring comprehensive documentation consistency.

docs/investigations/map-event-management-system.md (5)

43-43: Architecture diagram correctly updated.

The diagram accurately reflects Map Ruler's new priority of 100 in the consumer systems hierarchy.


131-131: Code example properly reflects implementation.

The example code comment correctly shows the updated priority value, maintaining documentation-code consistency.


171-171: Sequence diagram accurately updated.

The sequence diagram correctly shows Map Ruler with priority 100, maintaining consistency with the event flow documentation.


214-214: System inventory table correctly updated.

The registered listeners table accurately reflects Map Ruler's priority change to 100, ensuring comprehensive documentation consistency.


232-232: Analysis section properly synchronized.

The detailed listener purpose analysis correctly identifies the updated priority, maintaining thorough documentation accuracy.

docs/architecture/ADR-002-MapPopover-Event-System-Integration.md (4)

48-48: Problem statement diagram correctly updated.

The architectural diagram accurately shows Map Ruler's elevated priority in the event system hierarchy.


71-71: Problem description accurately reflects priority change.

The text correctly identifies Map Ruler's priority as 100, maintaining consistency with the implementation.


106-106: Priority assignment analysis table properly updated.

The table accurately reflects Map Ruler's priority change to 100, ensuring comprehensive architectural documentation.


275-275: Integration priority table correctly synchronized.

The ConnectedMap integration table accurately shows Map Ruler's priority as 100, maintaining architectural consistency.

src/features/map_ruler/renderers/MapRulerRenderer.test.ts (1)

12-32: Excellent test coverage with proper assertion messages.

The test thoroughly validates the Map Ruler's high-priority listener registration behavior. The custom assertion messages follow coding guidelines by including context about the expected behavior and failure reasons.

@alesiahil
Copy link
Contributor Author

Preview environments for this PR:

* Main App: https://konturio-disaster-ninja-fe-pr-1236-main.surge.sh

* Cosmos: https://konturio-disaster-ninja-fe-pr-1236-cosmos.surge.sh

These previews are automatically updated with each commit.

Note: After a new deployment, it may take a few minutes for the changes to propagate and for caches to update. During this time, you might experience temporary loading issues or see an older version of the app. If the app fails to load, please wait a few minutes and try again.

Checked: seems like working.

@alesiahil alesiahil self-assigned this Aug 3, 2025
@alesiahil alesiahil requested a review from a team August 3, 2025 22:05
@codecov
Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 12.03%. Comparing base (e42573e) to head (469c453).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...c/features/map_ruler/renderers/MapRulerRenderer.ts 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1236      +/-   ##
==========================================
+ Coverage   11.94%   12.03%   +0.08%     
==========================================
  Files         722      724       +2     
  Lines       29766    29797      +31     
  Branches     1387     1398      +11     
==========================================
+ Hits         3557     3585      +28     
- Misses      25653    25656       +3     
  Partials      556      556              
Components Coverage Δ
UI Components 0.29% <ø> (ø)
Core Logic 17.19% <ø> (+0.05%) ⬆️
Features 2.55% <0.00%> (+0.05%) ⬆️
Utilities 44.60% <ø> (+0.25%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link

codecov bot commented Aug 8, 2025

Bundle Report

Changes will increase total bundle size by 519 bytes (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
konturio/disaster-ninja-fe-esm 5.33MB 519 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: konturio/disaster-ninja-fe-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-*.js 4 bytes 10.18kB 0.04%
assets/index-*.js -66 bytes 14.97kB -0.44%
assets/index-*.js 295 bytes 4.53kB 6.97% ⚠️
assets/index-*.js 201 bytes 6.58kB 3.15%
assets/index-*.js -5 bytes 229.78kB -0.0%
assets/Map-*.js 96 bytes 622.76kB 0.02%
assets/MultivariateRenderer-*.js -6 bytes 9.39kB -0.06%

Files in assets/index-*.js:

  • ./src/features/map_ruler/renderers/MapRulerRenderer.ts → Total Size: 2.49kB

@vkozio vkozio merged commit 690a0d4 into main Aug 8, 2025
24 of 26 checks passed
@vkozio vkozio deleted the codex/make-map-layers-not-clickable-during-distance-tool branch August 8, 2025 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants